package com.quanyan.comment.reqeust;

import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/6/3.
 */
public class ReqRoleParams implements Serializable{

    /**
     * 角色id
     */
    private Integer roleId;

    /**
     * 角色编码 ，角色id 不能同时为空
     */
    private String roleCode;

    /**
     * 访问资源路径 不可为空
     */
    private String url;

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        return "ReqRoleParams{" +
                "roleId=" + roleId +
                ", roleCode='" + roleCode + '\'' +
                ", url='" + url + '\'' +
                '}';
    }

    public Map<String,Object> toMap(){
        Map<String,Object> map = new HashMap<String,Object>();
        if (roleId != null)
            map.put("roleId",roleId);

        if(StringUtils.isBlank(roleCode))
            map.put("roleCode",roleCode);

        if(StringUtils.isBlank(url))
            map.put("url",url);

        return map;
    }
}
